Clarify memory management of tree models
authorChristian Dywan <christian@lanedo.com>
Tue, 10 Aug 2010 01:35:26 +0000 (21:35 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 10 Aug 2010 01:35:26 +0000 (21:35 -0400)
It helps to be explicit about these things.
Bug 609264.

gtk/gtkliststore.c
gtk/gtktreemodel.c
gtk/gtktreestore.c

index a42daaa1da4eca0c311f16c165dc76ca95ff3cf3..b8b01f6b7b3ddd082e940e548ae142425a57b2d8 100644 (file)
@@ -986,7 +986,9 @@ gtk_list_store_set_valist (GtkListStore *list_store,
  * The list is terminated by a -1. For example, to set column 0 with type
  * %G_TYPE_STRING to "Foo", you would write <literal>gtk_list_store_set (store, iter,
  * 0, "Foo", -1)</literal>.
- * The value will be copied or referenced by the store if appropriate.
+ *
+ * The value will be referenced by the store if it is a %G_TYPE_OBJECT, and it
+ * will be copied if it is a %G_TYPE_STRING or %G_TYPE_BOXED.
  **/
 void
 gtk_list_store_set (GtkListStore *list_store,
index 192a06930fd34405f653bca038e58293a22cf6e0..b38d592bb9e2f27eab28229002106eda84bdfc16 100644 (file)
@@ -1415,8 +1415,10 @@ gtk_tree_model_unref_node (GtkTreeModel *tree_model,
  * write: <literal>gtk_tree_model_get (model, iter, 0, &amp;place_string_here, -1)</literal>,
  * where <literal>place_string_here</literal> is a <type>gchar*</type> to be 
  * filled with the string.
- * If appropriate, the returned values have to be freed or unreferenced.
  *
+ * Returned values with type %G_TYPE_OBJECT have to be unreferenced, values
+ * with type %G_TYPE_STRING or %G_TYPE_BOXED have to be freed. Other values are
+ * passed by value.
  **/
 void
 gtk_tree_model_get (GtkTreeModel *tree_model,
index 4570007018d9b3481074d0ee71140f1d2a621726..7047dfb861cd712e1c3dc723fce6262a26d5d174 100644 (file)
@@ -1073,7 +1073,9 @@ gtk_tree_store_set_valist (GtkTreeStore *tree_store,
  * The list is terminated by a -1. For example, to set column 0 with type
  * %G_TYPE_STRING to "Foo", you would write 
  * <literal>gtk_tree_store_set (store, iter, 0, "Foo", -1)</literal>.
- * The value will be copied or referenced by the store if appropriate.
+ *
+ * The value will be referenced by the store if it is a %G_TYPE_OBJECT, and it
+ * will be copied if it is a %G_TYPE_STRING or %G_TYPE_BOXED.
  **/
 void
 gtk_tree_store_set (GtkTreeStore *tree_store,